<?php
include ('template/header2.php');
   include("db_config.php"); 
   $link=Conectarse(); 
?>
<script>
function validarNum(e)
{
    tecla = (document.all) ? e.keyCode : e.which;
    if (tecla == 8) return true;
    patron = /[0-9\,\.]/;
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
</script>
<?php
	$usua=$_POST['usua'];
	$n_pro=mysql_query("select usuario from asesor where usuario='$usua'");
	if(mysql_fetch_array($n_pro)>0){
?>
<script language="javascript">alert ('ese usuario ya existe'); </script>
<script type="text/javascript"> window.location="agregar_asesor.php"</script>
<?php
} else{
?>
<?php 
   $nombre=$_POST['nombre']; 
   $apellido=$_POST['apellido']; 
   $email=$_POST['email'];  
   //$horario=$_POST['horario']; 
   $helun=$_POST['helun'];
   $hemar=$_POST['hemar'];
   $hemie=$_POST['hemie'];
   $hejue=$_POST['hejue'];
   $hevie=$_POST['hevie'];
   $hslun=$_POST['hslun'];
   $hsmar=$_POST['hsmar'];
   $hsmie=$_POST['hsmie'];
   $hsjue=$_POST['hsjue'];
   $hsvie=$_POST['hsvie'];
   $extension=$_POST['extension'];  
   $especialidad=$_POST['especialidad'];    
   $usua=$_POST['usua'];  
   $password=$_POST['password'];
   
 
	
if ($nombre!="" && $apellido!="" && $email!="" && $helun!="" && $hemar!="" && $hemie!="" && $hejue!="" && $hevie!="" && $hslun!="" && $hsmar!="" && $hsmie!="" && $hsjue!="" && $hsvie!="" && $extension!="" && $especialidad!="" && $usua!="" && $password!=""){
   $nombre=$_POST['nombre']; 
   $apellido=$_POST['apellido']; 
   $email=$_POST['email'];  
//   $horario=$_POST['horario']; 
   $helun=$_POST['helun'];
   $hemar=$_POST['hemar'];
   $hemie=$_POST['hemie'];
   $hejue=$_POST['hejue'];
   $hevie=$_POST['hevie'];
   $hslun=$_POST['hslun'];
   $hsmar=$_POST['hsmar'];
   $hsmie=$_POST['hsmie'];
   $hsjue=$_POST['hsjue'];
   $hsvie=$_POST['hsvie'];
   $extension=$_POST['extension']; 
   $especialidad=$_POST['especialidad'];        
   $usua=$_POST['usua'];  
   $password=$_POST['password'];
   $fecha=date("Y-m-d H:i");
   $grupo="asesor";
   
  mysql_query("insert into asesor (nombre, apellido, email, helun, hemar, hemie, hejue, hevie, hslun, hsmar, hsmie, hsjue, hsvie, extension, especialidad, usuario, password, fecha, grupo) values ('$nombre', '$apellido', '$email', '$helun','$hemar','$hemie','$hejue','$hevie','$hslun','$hsmar','$hsmie','$hsjue','$hsvie','$extension','$especialidad','$usua','$password','$fecha','$grupo')",$link); 
	
	mysql_query("insert into usuario (nombre, apellido,email, grupo, usuario, password) values ('$nombre', '$apellido', '$email', '$grupo','$usua','$password')",$link);
     
?>

<div align="center">

	<table cellpadding="0" cellspacing="0" width="970" height="20">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" height="20" width="970" background="IMG/bg2.jpg">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
		</tr>
	</table>
</div>
<div align="center">
	<table cellpadding="0" cellspacing="0" background="IMG/bg3.jpg" width="970" height="375">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" rowspan="2" width="15">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
			<td height="23" background="IMG/bg5.jpg">
			<font face="Calibri" color="#FFFFFF">&nbsp;&nbsp; Bienvenido  </font>
			<font face="Calibri" color="#FF6600" style="font-weight: 700" size="2"></font></td>
			<td valign="top" rowspan="2" width="10">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
			<td valign="top" rowspan="2" width="10">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
			
			<td valign="top" rowspan="2" width="15">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
		</tr>
		<tr>
			<td valign="top" width="750">
			
			<p><b><font color="#666666" size="2" face="Calibri">Nuevo Asesor </font></b>
			<p align="center" style="margin-top: 0; margin-bottom: 0"><p align="center" style="margin-top: 0; margin-bottom: 0"><p align="center" style="margin-top: 0; margin-bottom: 0"><p align="center" style="margin-top: 0; margin-bottom: 0">
			<b><font size="4">Asesor Agregado</font></b><p align="center" style="margin-top: 0; margin-bottom: 0">
		  <font color="#800000" size="5">Gracias</font></td>
			
		</tr>
  </table>
</div>
<div align="center">
	<table cellpadding="0" cellspacing="0" width="970" height="20">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" height="20" width="970" background="IMG/bg4.jpg">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
		</tr>
	</table>
</div>
<?php
} else{
?>
<div align="center">

	<table cellpadding="0" cellspacing="0" width="970" height="20">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" height="20" width="970" background="IMG/bg2.jpg">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
		</tr>
	</table>
</div>
<div align="center">
	<table cellpadding="0" cellspacing="0" background="IMG/bg3.jpg" width="970" height="452">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" rowspan="2" width="15">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
			<td height="25" background="IMG/bg5.jpg">
			<font face="Calibri" color="#FFFFFF">&nbsp;&nbsp; Bienvenido  </font>
			<font face="Calibri" color="#FF6600" style="font-weight: 700" size="2"></font></td>
			
			<td valign="top" rowspan="2" width="10">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
			<td valign="top" rowspan="2" width="10">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
			
			<td valign="top" rowspan="2" width="15">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
		</tr>
		<tr>
			<td valign="top" width="750">
			<form name="forma1" method="POST" action="registra_asesor2.php" enctype="multipart/form-data">
				<div align="center">
				<table cellpadding="0" cellspacing="0" width="600" height="228">
					<tr>
							<td valign="top" colspan="6" height="30"><b><font color="#666666" size="2" face="Calibri">Nuevo Asesor </font></b></td>
				  </tr>
						<tr>
							<td><b><font face="Calibri" size="2">Nombre(s): </font></b></td>
							<td height="25" colspan="5">
							<input type="text"  maxlength="20" name="nombre" size="25" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" onKeyPress="if (event.keyCode > 45 && event.keyCode < 58) event.returnValue = false"></td>
						</tr>
						<tr>
							<td><b><font face="Calibri" size="2">Apellido(s): </font></b></td>
							<td height="25" colspan="5">
							<input type="text"  maxlength="25" name="apellido" size="25" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" onKeyPress="if (event.keyCode > 45 && event.keyCode < 58) event.returnValue = false"></td>
						</tr>
						<tr>
							<td><b><font face="Calibri" size="2">Email:
							</font></b></td>
							<td height="25" colspan="5">
							<input type="text"  maxlength="30" name="email" size="25" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" ></td>
				  </tr>
						<tr>
							<td colspan="10"><b><font face="Calibri" size="2">Horario: </font>
							</b></td>
						</tr>
						<tr>
							<td>Dia</td>
						    <td width="48">Lunes</td>
						    <td width="48">Martes</td>
						    <td width="96">Miercoles</td>
						    <td width="96">Jueves</td>
						    <td width="96">Viernes</td>
						    
						</tr>
						<tr>
							<td>H. Entrada </td>
						    <td width="0">
							<select name="helun">
								<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
							</select>							</td>
						    <td width="0"><select name="hemar">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="0"><select name="hemie">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="0"><select name="hejue">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="96"><select name="hevie">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    
						</tr>
						<tr>
							<td>H. Salida </td>
						    <td width="0"><select name="hslun">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="0"><select name="hsmar">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="0"><select name="hsmie">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="0"><select name="hsjue">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    <td width="96"><select name="hsvie">
<option value="07:00">07:00</option>
								<option value="07:30">07:30</option>
								<option value="08:00">08:00</option>
								<option value="08:30">08:30</option>
								<option value="09:00">09:00</option>
								<option value="09:30">09:30</option>
								<option value="10:00">10:00</option>
								<option value="10:30">10:30</option>
								<option value="11:00">11:00</option>
								<option value="11:30">11:30</option>
								<option value="12:00">12:00</option>
								<option value="12:30">12:30</option>
								<option value="13:00">13:00</option>
								<option value="13:30">13:30</option>
								<option value="14:00">14:00</option>
								<option value="14:30">14:30</option>
								<option value="15:00">15:00</option>
								<option value="15:30">15:30</option>
								<option value="16:00">16:00</option>
								<option value="16:30">16:30</option>
								<option value="17:00">17:00</option>
								<option value="17:30">17:30</option>
								<option value="18:00">18:00</option>
								<option value="18:30">18:30</option>
								<option value="19:00">19:00</option>
								<option value="19:30">19:30</option>
								<option value="20:00">20:00</option>
								<option value="20:30">20:30</option>
								<option value="21:00">21:00</option>
								<option value="21:30">21:30</option>
</select></td>
						    
						</tr>
						<tr>
							<td><b><font face="Calibri" size="2">Extension: </font></b></td>
							<td height="25" colspan="5">
							<input type="text"  maxlength="5" name="extension" size="10" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" onKeyPress="return validarNum(event)" ></td>
						</tr>
						<tr>
							<td><b><font face="Calibri" size="2">Area de especialidad: </font></b></td>
							<td height="25">
							<input type="text"  maxlength="50" name="especialidad" size="40" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" onKeyPress="return validarNum(event)" ></td>
						</tr>
						<tr>
							<td><b><font face="Calibri" size="2">Usuario: </font></b></td>
							<td height="25" colspan="5">
							<input type="text"  maxlength="15" name="usua" size="15" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" ></td>
						</tr>
						<tr>
							<td><b><font face="Calibri" size="2">Password: </font></b></td>
							<td height="25" colspan="5">
							<input type="password"  maxlength="25" name="password" size="25" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 2px solid #C0C0C0; background-color: #E4E4E4" ></td>
						</tr>

						<tr>
							<td>&nbsp;</td>
							<td height="25" colspan="5">
							<p align="left">
							<input type="submit" value="Guardar" name="B1" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 1px solid #C0C0C0">
							<input type="reset" value="Limpiar" name="B2" style="font-family: Calibri; font-size: 10pt; font-weight: bold; border: 1px solid #C0C0C0"></td>
						</tr>
						<tr>
							<td width="130">&nbsp;</td>
							<td width="470" height="46" colspan="5">&nbsp;</td>
						</tr>
				  </table>
				</div>
			</form>
			<p>
			<p style="margin-top: 0; margin-bottom: 0" align="center"><b>
			<font face="Calibri" color="#006699" size="2">Favor de llenar TODOS los campos</font></b></p>
			<p style="margin-top: 0; margin-bottom: 0" align="center"><b>
			<font face="Calibri" color="#006699" size="4">Para poder completar el proceso</font></b></td>
			
		</tr>
  </table>
</div>
			<div align="center">
			  <table cellpadding="0" cellspacing="0" width="970" height="20">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" height="20" width="970" background="IMG/bg4.jpg">
			<!-- MSCellType="empty" -->
			&nbsp;</td>
		</tr>
	</table>
</div>
		  <?php 
		  }
		  }
		  ?>
	
</body>

</html>